In this step, you will add the code needed for your application.
C# |
Copy Code
|
---|---|
using C1.BarCode;
|
C# |
Copy Code
|
---|---|
this.InitializeComponent(); this.Loaded += MainPage_Loaded; |
C# |
Copy Code
|
---|---|
void MainPage_Loaded(object sender, RoutedEventArgs e) { cbCodeType.ItemsSource = Enum.GetValues(typeof(CodeType)); cbCodeType.SelectedItem = barcode.CodeType; } |
C# |
Copy Code
|
---|---|
private async void cbCodeType_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (barcode != null && cbCodeType != null && cbCodeType.SelectedItem != null) { barcode.CodeType = (CodeType)cbCodeType.SelectedItem; } if (barcode.CodeType != CodeType.QRCode || !text.Text.Equals("http://www.componentone.com")) { image.Opacity = 0; } else { image.Opacity = 1; } } catch (Exception ex) { await new Windows.UI.Popups.MessageDialog(ex.Message, "Error").ShowAsync(); } } |
C# |
Copy Code
|
---|---|
private void text_TextChanged(object sender, TextChangedEventArgs e) { { if (!string.IsNullOrEmpty(text.Text) && text.Text.Equals("http://www.componentone.com") && barcode.CodeType == CodeType.QRCode) image.Opacity = 1; else image.Opacity = 0; } } |
In this step, you added code to control the appearance of the C1BarCode control. In the next step, you will run the application.